<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<title>${title}</title>
<%@include file="/WEB-INF/templates/common/common.jsp"%>
<style>
	td{border:1px solid red;text-align:center}
	.input_change{border: 1px red solid;}
</style>
<script type="text/javascript" src="${basePath}/static/page/js/jqPaginator.js"></script>
<script type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath}/static/js/util.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_style.css" rel="stylesheet" type="text/css">
</head>
<body>

</head>
<body>
 <!--头部-->
 <%@include file="/WEB-INF/templates/common/header.jsp"%>

<!------导航条-->
 <%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<div class="list_main lay_out">
 <div class="list_DH">
    <!--打印模块导航栏-->
 <%@include file="/WEB-INF/templates/common/printnav.jsp"%>
 </div>
 <div class="list_NR">
  <div class="loc">
   <h3>邮寄登记</h3>
  </div>
 
  <div class="list_con_table"> 
   <div class="search_table">
   
    <ul id="table_ul" class="clearfix" style="margin-bottom:0;">
    <form method="post" action="${basePath}/print/addPrintMailRecord" id="addPrintRecord" style="width:100%">
    <input type="hidden" name="isMail" value="${printRecord.isMail}">
    <input type="hidden" id="firstGuid" name="firstGuid" value="${printRecord.firstGuid}">
    <input type="hidden" id="printReason" name="printReason" value="${printRecord.printReason}" >
    <li class="Label_1" style="width:15%">病案所属人姓名：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="40" name='name'  value='${printRecord.name}'readonly="readonly" style="background-color: #D3D3D3;" /></li>
    <li class="Label_1" style="width:12%">就诊标示：</li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="60" name='mrId'  value='${printRecord.mrId}'readonly="readonly" style="background-color: #D3D3D3;" /></li>
    <li class="Label_1">身份证：</li>
    <li class="Label_2"> 
    	<input class="input_box" type="text" maxlength="40" name='idCard'  value='${printRecord.idCard}' readonly="readonly" style="background-color: #D3D3D3;" />
     </li> 
     <li class="Label_1" style="width:15%">操作人：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="40" name='operator'  value='${printRecord.operator}'  readonly="readonly" style="background-color: #D3D3D3;" /></li>
    <li class="Label_1" style="width:12%">出院时间：</li>
    <li class="Label_2"><input class="input_box" type="text" id="applyDate"  name="outTime" readonly="readonly" value="<fmt:formatDate value="${printRecord.outTime}" pattern="yyyy-MM-dd hh:mm"/>" style="background-color: #D3D3D3;"/></li>
     <li class="Label_1">打印页数：</li>
    <li class="Label_2"> 
    	<input class="input_box" type="text" maxlength="40" name='printPage'  value='${printRecord.printPage}' readonly="readonly" style="background-color: #D3D3D3;" />
     </li>
     <li class="Label_1" style="width:15%">收件姓名：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="40" id="recipients" name='recipients'  value='' title=''/></li>
    <li class="Label_1" style="width:12%">收件人地址：</li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="60" id="address" name='address'  value='' title=''/></li>
     <li class="Label_1">收件人联系方式：</li>
    <li class="Label_2"> 
    	<input class="input_box" type="text" maxlength="40" id="telephone" name='telephone'  value='' title=''/>
     </li>
     
    <li class="Label_5">
	   <a onclick="addPrintMailRecord()">保存</a>
    </li>
    </form>
    </ul>
  </div>
 </div>
</div>
</div>
<!--页脚部分-->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>
 <script>
 function addPrintMailRecord(){
	 $("input,select").focus(function() { 
			$("[title='']").each(function() {
		  		$("[title='']").removeClass("input_change");
		  		
			});
	 	});
	 var recipients=$("#recipients").val();
	 var address=$("#address").val();
	 var telephone=$("#telephone").val();
	 
	 var num=0;//变量为1时 数据为空
	 var notNull=false;//变量为true时提交数据
	 $("[title='']").each(function() { //遍历元素对象   
       if ($(this).val()=="") { //判断元素对象的value值  
             $(this).addClass("input_change");  //添加css样式  
           num=1;
       }else{  
     	  notNull=true;
       }  
     }); 
		 	if(num==1){
			  layer.alert("必选项不能为空!", {icon: 0});
			  notNull=false;
			  return;
		  	}
		 	if(notNull==true){
		 		/* var flag=checkChinese(recipients);
		 		if(flag==false){
		 			layer.alert("姓名格式不正确或超出长度!", {icon: 0});
    		 		$("#recipients").addClass("input_change");
    		 		return;
		 		}
		 		 */
		 		if(validatePhone(telephone)==false){
		 			layer.alert("联系方式格式不正确!", {icon: 0});
					$("#telephone").addClass("input_change");
					return;
		 		}
		 	}
	 $("#addPrintRecord").submit();
 }
 
 window.onload = function(){
	 var medicalOnlyId=$("#firstGuid").val();
	 var applyReason=$("#printReason").val();
	 openPrint(medicalOnlyId,applyReason);
 }

 	
 	function openPrint(medicalOnlyId,applyReason){
  		window.open("${basePath}/print/printPic?medicalOnlyId="+medicalOnlyId+"&applyReason="+applyReason+"",
 				'_blank',
 				"toolbar=yes,resizable=1, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=800, height=600"); 
 	}
	
 </script>

</body>
</html>
